<?php include('../../Connections/KRAPPERCON.php')?>

<?php 
$oculcod = '';
if (isset($_POST['oculcod'])) {
 $oculcod = trim($_POST["oculcod"]); 
 }

// maximo por pagina
$limit =1000;

// pagina pedida
$pag = 0;
if (isset($_GET['pag'])) {
$pag = (int) $_GET["pag"];
}
if ($pag < 1)
{
   $pag = 1;
}
$offset = ($pag-1) * $limit;

?>
<style type="text/css">
<!--
.Estilo4 {color: #FF6600; font-weight: bold; font-family: calibri; }
.Estilo5 {color: #990000}
.Estilo6 {color: #990000; font-weight: bold; font-family: calibri; }
-->
</style>




<table width="100%" border="1" cellpadding=2 cellspacing=1 id="tblheader" rules="all" >
    <thead>
    <tr >
      <th class="Estilo6"><div align="center" class="Estilo6">Editar</div></th>
     <th class="Estilo6"><div align="center" class="Estilo6">Nombre</div></th>
      <th class="Estilo6"><div align="center" class="Estilo6">Descripcion</div></th>
      <th class="Estilo6"><div align="center" class="Estilo6">Precio</div></th>
      <th class="Estilo6"><div align="center" class="Estilo6">Costo</div></th>
      <th class="Estilo6"><div align="center" class="Estilo6">Estado</div></th>
      <th class="Estilo6"><div align="center" class="Estilo6">ArticuloIDnew</div></th>
    </tr></thead>
    <?php 
	  	   


$result = "

select  a.articuloid,a.ArticuloName,a.articulodesc,
a.MarcaID,a.FamilyID,a.ColorID,a.ClaseID,
a.ProveedID as proveedd,a.ArticuloPre as Precio,a.ArticuloCos as Costo,a.ArticuloSts,
case when ArticuloSts = '1' then 'ACTIVO' else 'INACTIVO' end as estado 
,a.ArticuloIDNew
from tt_articulo a

LIMIT $offset, $limit

;


";
$sqlTotal = "SELECT count(*) as total from  tt_articulo;";
$res2 = $mysqli->query($sqlTotal);
$res = $mysqli->query($result);
if ($res2){
while($row = $res2->fetch_assoc()) {
$total = $row['total'];
}
}

if ($res) {
		while($row4 = $res->fetch_assoc()) {
?>
  <tbody>
    <tr>
      <td height="30">
      <a href="#" onClick="clicksCod(this)"><?php echo ($row4['articuloid']);  ?></a></td>

      <td><?php echo ($row4["ArticuloName"])  ?></td>
      <td><?php echo ($row4["articulodesc"])  ?></td>
      <!-- <td><?php echo ($row4["ProveedNom"])  ?></td>-->
      <td><?php echo ($row4["Precio"])  ?></td>
      <td><?php echo ($row4["Costo"])  ?></td>
      <td><?php echo ($row4["estado"])  ?></td>
      <td><?php echo ($row4["ArticuloIDNew"])  ?></td>
    </tr>
    </tbody>
    <?php
 
 	}
$res->close();
$mysqli->check_result();
}

?>
<tfoot><tr>
  <td colspan="9">
   
   <?php
         $totalPag = ceil($total/$limit);
         $links = array();
         for( $i=1; $i<=$totalPag ; $i++)
         {
            $links[] = "<a href=\"?pag=$i\">$i</a>"; 
         }
         echo implode(" - ", $links);
      ?>  </td>
</tr></tfoot>
  </table>

<script type="text/javascript">




</script>